package com.maxatime.service.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.maxatime.dao.ExamStudentLianxi1Mapper;
import com.maxatime.pojo.entity.ExamStudentLianxi1;
import com.maxatime.service.ExamStudentLianxi1SER;

@Service
public class ExamStudentLianxi1IMP implements ExamStudentLianxi1SER{
	
	@Autowired
	ExamStudentLianxi1Mapper examStudentLianxi1Mapper;

	@Override
	public int deleteByPrimaryKey(Integer pkId) {
		// TODO Auto-generated method stub
		return examStudentLianxi1Mapper.deleteByPrimaryKey(pkId);
	}

	@Override
	public int insert(ExamStudentLianxi1 record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insertSelective(ExamStudentLianxi1 record) {
		// TODO Auto-generated method stub
		ExamStudentLianxi1 examStudentLianxi1 = new ExamStudentLianxi1();
		BeanUtils.copyProperties(record, examStudentLianxi1);
		Date d = new Date();
		examStudentLianxi1.setRemark("0");
		examStudentLianxi1.setDeleteFlag("0");
		examStudentLianxi1.setCreateTime(d);
		examStudentLianxi1.setUpdateTime(d);
		examStudentLianxi1Mapper.insertSelective(examStudentLianxi1);
		return 0;
	}

	@Override
	public ExamStudentLianxi1 selectByPrimaryKey(Integer pkId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int updateByPrimaryKeySelective(ExamStudentLianxi1 record) {
		// TODO Auto-generated method stub
		ExamStudentLianxi1 examStudentLianxi1 = new ExamStudentLianxi1();
		BeanUtils.copyProperties(record, examStudentLianxi1);
		Date d = new Date();
		examStudentLianxi1.setUpdateTime(d);
		examStudentLianxi1Mapper.updateByPrimaryKeySelective(examStudentLianxi1);
		return 0;
	}

	@Override
	public int updateByPrimaryKey(ExamStudentLianxi1 record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Map<String, Object> map(ExamStudentLianxi1 examStudentLianxi1) {
		// TODO Auto-generated method stub
		PageHelper.startPage(examStudentLianxi1.getPageNum(),examStudentLianxi1.getPageSize());
		List<ExamStudentLianxi1> list = examStudentLianxi1Mapper.list(examStudentLianxi1);
		PageInfo<ExamStudentLianxi1> pageinfo = new PageInfo<ExamStudentLianxi1>(list);
		Map<String, Object> m = new HashMap<>();
		m.put("list", list);
		m.put("pageInfo", pageinfo);
		return m;
	}

	@Override
	public ExamStudentLianxi1 find(int pkId) {
		// TODO Auto-generated method stub
		return examStudentLianxi1Mapper.find(pkId);
	}

}
